package com.strato.mybatis.generator.v1_2_0.project.impl;

import java.io.File;

import com.strato.mybatis.generator.v1_2_0.config.GenerateConfig;
import com.strato.mybatis.generator.v1_2_0.project.ProjectModel;

public class CustomProjectModel implements ProjectModel {

	@Override
	public File getXmlBase(File rootDir) {
		File src = new File(rootDir,GenerateConfig.getInstance().getProperties().getProperty("project.model.custom.xmlBase"));
		if(src.exists()){
			return src;
		}
		
		return rootDir;
	}

	@Override
	public File getModelBase(File rootDir) {
		File src = new File(rootDir,GenerateConfig.getInstance().getProperties().getProperty("project.model.custom.modelBase"));
		if(src.exists()){
			return src;
		}
		return rootDir;
	}

	@Override
	public File getMapperBase(File rootDir) {
		File src = new File(rootDir,GenerateConfig.getInstance().getProperties().getProperty("project.model.custom.mapperBase"));
		if(src.exists()){
			return src;
		}
		return rootDir;
	}

	@Override
	public boolean isProjectRoot(File dir) {
		return false;
	}

	@Override
	public String getName() {
		return "custom";
	}

	@Override
	public String getLabel() {
		return "Custom";
	}

}
